import*as Ne from"react";import{useSyncExternalStoreWithSelector as wt}from"use-sync-external-store/with-selector.js";import*as L from"react";var p="default"in L?L.default:L;var re=Symbol.for("react-redux-context"),ne=typeof globalThis<"u"?globalThis:{};function Ve(){if(!p.createContext)return{};let e=ne[re]??(ne[re]=new Map),t=e.get(p.createContext);return t||(t=p.createContext(null),e.set(p.createContext,t)),t}var S=Ve();var Y=()=>{throw new Error("uSES not initialized!")};function V(e=S){return function(){return p.useContext(e)}}var z=V();var Te=Y,fe=e=>{Te=e},We=(e,t)=>e===t;function Se(e=S){let t=e===S?z:V(e),o=(n,r={})=>{let{equalityFn:s=We,devModeChecks:c={}}=typeof r=="function"?{equalityFn:r}:r,{store:u,subscription:i,getServerState:a,stabilityCheck:P,identityFunctionCheck:l}=t(),T=p.useRef(!0),w=p.useCallback({[n.name](b){let d=n(b);if(!1){if((f==="always"||f==="once"&&T.current)&&!s(d,m))try{}catch(j){}if((x==="always"||x==="once"&&T.current)&&d===b)try{}catch(C){}}return d}}[n.name],[n,P,c.stabilityCheck]),y=Te(i.addNestedSub,u.getState,a||u.getState,w,s);return p.useDebugValue(y),y};return Object.assign(o,{withTypes:()=>o}),o}var Ue=Se();var je=Symbol.for("react.element"),qe=Symbol.for("react.portal"),$e=Symbol.for("react.fragment"),Le=Symbol.for("react.strict_mode"),Ye=Symbol.for("react.profiler"),ze=Symbol.for("react.provider"),He=Symbol.for("react.context"),Be=Symbol.for("react.server_context"),ye=Symbol.for("react.forward_ref"),Ke=Symbol.for("react.suspense"),Xe=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),Ge=Symbol.for("react.lazy"),It=Symbol.for("react.offscreen"),Vt=Symbol.for("react.client.reference"),me=ye,he=se;function Je(e){if(typeof e=="object"&&e!==null){let t=e.$$typeof;switch(t){case je:{let o=e.type;switch(o){case $e:case Ye:case Le:case Ke:case Xe:return o;default:{let n=o&&o.$$typeof;switch(n){case Be:case He:case ye:case Ge:case se:case ze:return n;default:return t}}}}case qe:return t}}}function xe(e){return Je(e)===se}function Ze(e,t,o,n,{areStatesEqual:r,areOwnPropsEqual:s,areStatePropsEqual:c}){let u=!1,i,a,P,l,T;function w(f,m){return i=f,a=m,P=e(i,a),l=t(n,a),T=o(P,l,a),u=!0,T}function y(){return P=e(i,a),t.dependsOnOwnProps&&(l=t(n,a)),T=o(P,l,a),T}function b(){return e.dependsOnOwnProps&&(P=e(i,a)),t.dependsOnOwnProps&&(l=t(n,a)),T=o(P,l,a),T}function d(){let f=e(i,a),m=!c(f,P);return P=f,m&&(T=o(P,l,a)),T}function x(f,m){let C=!s(m,a),j=!r(f,i,m,a);return i=f,a=m,C&&j?y():C?b():j?d():T}return function(m,C){return u?x(m,C):w(m,C)}}function pe(e,{initMapStateToProps:t,initMapDispatchToProps:o,initMergeProps:n,...r}){let s=t(e,r),c=o(e,r),u=n(e,r);return Ze(s,c,u,e,r)}function ae(e,t){let o={};for(let n in e){let r=e[n];typeof r=="function"&&(o[n]=(...s)=>t(r(...s)))}return o}function W(e){return function(o){let n=e(o);function r(){return n}return r.dependsOnOwnProps=!1,r}}function we(e){return e.dependsOnOwnProps?!!e.dependsOnOwnProps:e.length!==1}function H(e,t){return function(n,{displayName:r}){let s=function(u,i){return s.dependsOnOwnProps?s.mapToProps(u,i):s.mapToProps(u,void 0)};return s.dependsOnOwnProps=!0,s.mapToProps=function(u,i){s.mapToProps=e,s.dependsOnOwnProps=we(e);let a=s(u,i);return typeof a=="function"&&(s.mapToProps=a,s.dependsOnOwnProps=we(a),a=s(u,i)),a},s}}function k(e,t){return(o,n)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${n.wrappedComponentName}.`)}}function Ce(e){return e&&typeof e=="object"?W(t=>ae(e,t)):e?typeof e=="function"?H(e,"mapDispatchToProps"):k(e,"mapDispatchToProps"):W(t=>({dispatch:t}))}function Oe(e){return e?typeof e=="function"?H(e,"mapStateToProps"):k(e,"mapStateToProps"):W(()=>({}))}function Qe(e,t,o){return{...o,...e,...t}}function et(e){return function(o,{displayName:n,areMergedPropsEqual:r}){let s=!1,c;return function(i,a,P){let l=e(i,a,P);return s?r(l,c)||(c=l):(s=!0,c=l),c}}}function De(e){return e?typeof e=="function"?et(e):k(e,"mergeProps"):()=>Qe}function B(e){e()}function tt(){let e=null,t=null;return{clear(){e=null,t=null},notify(){B(()=>{let o=e;for(;o;)o.callback(),o=o.next})},get(){let o=[],n=e;for(;n;)o.push(n),n=n.next;return o},subscribe(o){let n=!0,r=t={callback:o,next:null,prev:t};return r.prev?r.prev.next=r:e=r,function(){!n||e===null||(n=!1,r.next?r.next.prev=r.prev:t=r.prev,r.prev?r.prev.next=r.next:e=r.next)}}}}var be={notify(){},get:()=>[]};function K(e,t){let o,n=be,r=0,s=!1;function c(b){P();let d=n.subscribe(b),x=!1;return()=>{x||(x=!0,d(),l())}}function u(){n.notify()}function i(){y.onStateChange&&y.onStateChange()}function a(){return s}function P(){r++,o||(o=t?t.addNestedSub(i):e.subscribe(i),n=tt())}function l(){r--,o&&r===0&&(o(),o=void 0,n.clear(),n=be)}function T(){s||(s=!0,P())}function w(){s&&(s=!1,l())}let y={addNestedSub:c,notifyNestedSubs:u,handleChangeWrapper:i,isSubscribed:a,trySubscribe:T,tryUnsubscribe:w,getListeners:()=>n};return y}var ot=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",A=ot?p.useLayoutEffect:p.useEffect;function Re(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function F(e,t){if(Re(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;let o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(let r=0;r<o.length;r++)if(!Object.prototype.hasOwnProperty.call(t,o[r])||!Re(e[o[r]],t[o[r]]))return!1;return!0}var rt={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},nt={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},st={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},ke={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},pt={[me]:st,[he]:ke};function Me(e){return xe(e)?ke:pt[e.$$typeof]||rt}var at=Object.defineProperty,ct=Object.getOwnPropertyNames,ge=Object.getOwnPropertySymbols,it=Object.getOwnPropertyDescriptor,ut=Object.getPrototypeOf,Ee=Object.prototype;function U(e,t){if(typeof t!="string"){if(Ee){let s=ut(t);s&&s!==Ee&&U(e,s)}let o=ct(t);ge&&(o=o.concat(ge(t)));let n=Me(e),r=Me(t);for(let s=0;s<o.length;++s){let c=o[s];if(!nt[c]&&!(r&&r[c])&&!(n&&n[c])){let u=it(t,c);try{at(e,c,u)}catch{}}}}return e}var Ae=Y,Fe=e=>{Ae=e};var Pt=[null,null];function lt(e,t,o){A(()=>e(...t),o)}function dt(e,t,o,n,r,s){e.current=n,o.current=!1,r.current&&(r.current=null,s())}function Tt(e,t,o,n,r,s,c,u,i,a,P){if(!e)return()=>{};let l=!1,T=null,w=()=>{if(l||!u.current)return;let b=t.getState(),d,x;try{d=n(b,r.current)}catch(f){x=f,T=f}x||(T=null),d===s.current?c.current||a():(s.current=d,i.current=d,c.current=!0,P())};return o.onStateChange=w,o.trySubscribe(),w(),()=>{if(l=!0,o.tryUnsubscribe(),o.onStateChange=null,T)throw T}}function ft(e,t){return e===t}function St(e,t,o,{pure:n,areStatesEqual:r=ft,areOwnPropsEqual:s=F,areStatePropsEqual:c=F,areMergedPropsEqual:u=F,forwardRef:i=!1,context:a=S}={}){let P=a,l=Oe(e),T=Ce(t),w=De(o),y=!!e;return d=>{let x=d.displayName||d.name||"Component",f=`Connect(${x})`,m={shouldHandleStateChanges:y,displayName:f,wrappedComponentName:x,WrappedComponent:d,initMapStateToProps:l,initMapDispatchToProps:T,initMergeProps:w,areStatesEqual:r,areStatePropsEqual:c,areOwnPropsEqual:s,areMergedPropsEqual:u};function C(O){let[g,G,R]=p.useMemo(()=>{let{reactReduxForwardedRef:h,...E}=O;return[O.context,h,E]},[O]),v=p.useMemo(()=>{let h=P;return g?.Consumer,h},[g,P]),D=p.useContext(v),N=!!O.store&&!!O.store.getState&&!!O.store.dispatch,_e=!!D&&!!D.store,M=N?O.store:D.store,ie=_e?D.getServerState:M.getState,J=p.useMemo(()=>pe(M.dispatch,m),[M]),[_,ue]=p.useMemo(()=>{if(!y)return Pt;let h=K(M,N?void 0:D.subscription),E=h.notifyNestedSubs.bind(h);return[h,E]},[M,N,D]),Pe=p.useMemo(()=>N?D:{...D,subscription:_},[N,D,_]),Z=p.useRef(),Q=p.useRef(R),I=p.useRef(),le=p.useRef(!1),Ct=p.useRef(!1),ee=p.useRef(!1),te=p.useRef();A(()=>(ee.current=!0,()=>{ee.current=!1}),[]);let de=p.useMemo(()=>()=>I.current&&R===Q.current?I.current:J(M.getState(),R),[M,R]),Ie=p.useMemo(()=>E=>_?Tt(y,M,_,J,Q,Z,le,ee,I,ue,E):()=>{},[_]);lt(dt,[Q,Z,le,R,I,ue]);let $;try{$=Ae(Ie,de,ie?()=>J(ie(),R):de)}catch(h){throw te.current&&(h.message+=`
The error may be correlated with this previous error:
${te.current.stack}

`),h}A(()=>{te.current=void 0,I.current=void 0,Z.current=$});let oe=p.useMemo(()=>p.createElement(d,{...$,ref:G}),[G,d,$]);return p.useMemo(()=>y?p.createElement(v.Provider,{value:Pe},oe):oe,[v,oe,Pe])}let q=p.memo(C);if(q.WrappedComponent=d,q.displayName=C.displayName=f,i){let g=p.forwardRef(function(R,v){return p.createElement(q,{...R,reactReduxForwardedRef:v})});return g.displayName=f,g.WrappedComponent=d,U(g,d)}return U(q,d)}}var yt=St;function mt({store:e,context:t,children:o,serverState:n,stabilityCheck:r="once",identityFunctionCheck:s="once"}){let c=p.useMemo(()=>{let a=K(e);return{store:e,subscription:a,getServerState:n?()=>n:void 0,stabilityCheck:r,identityFunctionCheck:s}},[e,n,r,s]),u=p.useMemo(()=>e.getState(),[e]);return A(()=>{let{subscription:a}=c;return a.onStateChange=a.notifyNestedSubs,a.trySubscribe(),u!==e.getState()&&a.notifyNestedSubs(),()=>{a.tryUnsubscribe(),a.onStateChange=void 0}},[c,u]),p.createElement((t||S).Provider,{value:c},o)}var ht=mt;function X(e=S){let t=e===S?z:V(e),o=()=>{let{store:n}=t();return n};return Object.assign(o,{withTypes:()=>o}),o}var ce=X();function ve(e=S){let t=e===S?ce:X(e),o=()=>t().dispatch;return Object.assign(o,{withTypes:()=>o}),o}var xt=ve();var No=B;fe(wt);Fe(Ne.useSyncExternalStore);export{ht as Provider,S as ReactReduxContext,No as batch,yt as connect,ve as createDispatchHook,Se as createSelectorHook,X as createStoreHook,F as shallowEqual,xt as useDispatch,Ue as useSelector,ce as useStore};
//# sourceMappingURL=react-redux.browser.mjs.map